package cn.flying.cloud.system.position.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import cn.flying.cloud.system.position.entity.SysPostInfo;
import cn.flying.cloud.system.user.entity.SysUserInfo;

/**
 * <p>
 * 岗位信息表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-04-02 13:06:48
 */
@Mapper
public interface SysPostInfoMapper extends BaseMapper<SysPostInfo> {


    /**
     * 查询岗位对应的用户
     *
     * @param postId
     * @return
     */
    @Select({"select " +
            " t1.*  " +
            "from " +
            " sys_user_info t1, " +
            " sys_post_user t2  " +
            "where " +
            " t1.user_id = t2.user_id  " +
            " and t1.deleted = '0'  " +
            " and t2.deleted = '0'  " +
            " and t1.status = 'Y'  " +
            " and t1.tenant_id = #{tenantId}  " +
            " and t2.tenant_id = #{tenantId}  " +
            " and t2.post_id = #{postId}"})
    List<SysUserInfo> getUserByPostId(@Param("tenantId") String tenantId, @Param("postId") String postId);
}
